package com.sr.wslr.front.wxapp.controller;

import com.github.pagehelper.Page;
import com.sr.wslr.model.entity.WzbTCustInfo;
import com.sr.wslr.service.appservice.CustInfoServce;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Created by 17032906 on 2017/10/18.
 */
@Controller
@Slf4j
public class TestController extends BaseController {

    @Autowired
    CustInfoServce custInfoServce;

    @RequestMapping(value="/test",method= RequestMethod.GET)
    @ResponseBody
    public Object login(int pgNo, int pgSize, HttpServletRequest request) {
        Page<WzbTCustInfo> pg = custInfoServce.findByPage(pgNo, pgSize);
        HttpSession session = request.getSession();
        session.setAttribute("xx",request.getRequestURL().toString());
        log.info("xxxx");
        return  pg;
    }

    @RequestMapping(value="/test2",method= RequestMethod.GET)
    @ResponseBody
    public String get(HttpServletRequest request) {
        HttpSession session = request.getSession();
        String dd = (String)session.getAttribute("xx");
        session.getMaxInactiveInterval();
        return dd;
    }
}
